const mongoose = require("mongoose");
mongoose.connect("mongodb://localhost/test", {useMongoClient:true});
mongoose.Promise = Promise;

const Schema = mongoose.Schema;

var userSchema = new Schema({
  name:String,
  password:String,
  age:Number
});

const User = mongoose.model("User", userSchema);

var user1 = new User({
  name:"gk",
  password:"xxx",
  age:18
});
var user2 = new User({
  name:"gk2",
  password:"xxx",
  age:18
});

async function run(){
  await User.remove();
  const list1 = await User.find();
  console.log(list1);
  await user1.save();
  await user2.save();
  const list2 = await User.find();
  console.log(list2);
}

run();
// console.log(user1);
